package com.hythzx.ddns.config;


import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.profile.DefaultProfile;
import org.slf4j.Logger;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import static org.slf4j.LoggerFactory.getLogger;

/**
 * 阿里云配置类
 * @author zhaoyuan
 */
@Configuration
public class AliyunConfiguration {

	private final Logger log = getLogger(AliyunConfiguration.class);

	private final ApplicationProperties applicationProperties;

	public AliyunConfiguration(ApplicationProperties applicationProperties) {
		this.applicationProperties = applicationProperties;
	}

	@Bean
	public IAcsClient iAcsClient(){
		DefaultProfile defaultProfile = DefaultProfile.getProfile(
			applicationProperties.getAliyun().getRegion(),applicationProperties.getAliyun().getAppId(), applicationProperties.getAliyun().getAppSecret()
		);
		return new DefaultAcsClient(defaultProfile);
	}
}
